import { EventManager } from "../engine/EventManager";
import { Logger } from "../engine/Logger";
import ViewBase from "../engine/ViewBase";
import { EventConfig } from "../game/config/EventConfig";
import { RoomModel } from "../game/model/RoomModel";
import GameController from "../GameController";

const { ccclass, property } = cc._decorator;

@ccclass
export default class GameBase extends ViewBase {


    onEnable(): void {
        super.onEnable()
        EventManager.instance.on(EventConfig.Event_My_Leave_Game, () => {
            Logger.log("Event_My_Leave_Game===", RoomModel.instance)
            GameController.instance.reInitGame()
            if (RoomModel.instance.clubid > 0) {
                GameController.instance.gotoClub(true)
            } else {
                GameController.instance.gotoHall(false)
            }
        }, this)
    }

}